package yingyong;

public class ThreadTest extends Thread {
    private Service service;
    public ThreadTest(Service service) {
        this.service = service;

    }

    @Override
    public void run() {
        System.out.println("当前startTime是"+RunService.startTime);
        if(System.currentTimeMillis()-RunService.startTime<1000&&RunService.num<100){
            RunService.num++;
            service.print();
        }else{
            System.out.println("一秒内没争取到资源");
        }
    }
}
